package com.cdream.basic.algorithm.leetcode.string;

import java.util.HashSet;

public class Offer3 {
    public int findRepeatNumber(int[] nums) {
        HashSet<Integer> set = new HashSet<>();
        for (int num : nums) {
            if (set.contains(num)){
                return num;
            }else{
                set.add(num);
            }
        }
        return -1;
    }
}
